
ThisBuild / version := "0.1.0-SNAPSHOT"

ThisBuild / scalaVersion := "2.12.19"


val flinkVersion = "1.17.1"
val hadoopVersion = "3.3.4"
val flinkCDCVersion = "2.4.0"
val jdbcConnectorVer = "3.1.0-1.17"
val circeVersion = "0.14.10"
val packagePrefix = "com.nekonomics.lakehouse"

lazy val root = (project in file("."))
  .settings(
    name := "lakehouse"
  )


lazy val sharedDependencies = Seq(
  "org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "provided",
  "org.apache.flink" % "flink-clients" % flinkVersion % "provided",
  "org.apache.flink" % "flink-runtime-web" % flinkVersion % "provided",
  "org.apache.flink" % "flink-json" % flinkVersion % "provided",
  "org.apache.flink" % "flink-csv" % flinkVersion % "provided",
  "org.apache.hadoop" % "hadoop-client" % hadoopVersion % "provided",
  "org.slf4j" % "slf4j-api" % "1.7.25" % "provided",
  "org.slf4j" % "slf4j-log4j12" % "1.7.25" % "provided",
  "org.apache.logging.log4j" % "log4j-to-slf4j" % "2.14.0" % "provided",
  "org.apache.flink" %% "flink-table-api-scala-bridge" % flinkVersion % "provided",
  "org.apache.flink" % "flink-table-planner-loader" % flinkVersion % "provided",
  "org.apache.flink" % "flink-table-runtime" % flinkVersion % "provided",
  "org.apache.flink" % "flink-connector-files" % flinkVersion % "provided",
  "org.apache.paimon" % "paimon-flink-1.17" % "1.1.1" % "provided",
  "org.apache.flink" % "flink-connector-jdbc" % "3.1.2-1.17" % "provided",
  "org.postgresql" % "postgresql" % "42.7.5",

)


lazy val common = (project in file("common"))
  .settings(libraryDependencies ++= sharedDependencies)
  .settings(
    libraryDependencies ++= Seq(
      "io.lettuce" % "lettuce-core" % "6.2.4.RELEASE",
      "io.circe" %% "circe-core" % circeVersion,
      "io.circe" %% "circe-generic" % circeVersion,
      "io.circe" %% "circe-parser" % circeVersion,
      "io.circe" %% "circe-optics" % "0.14.1",
      "io.circe" %% "circe-generic-extras" % "0.14.4",

    ),
    idePackagePrefix := Some(s"$packagePrefix.common"),
  )

lazy val sku_dim = (project in file("dim/product_sku_dim"))
  .settings(
    idePackagePrefix := Some(s"$packagePrefix.dim"),
    libraryDependencies ++= sharedDependencies
  )
  .dependsOn(common )


lazy val merchant_dim = (project in file("dim/merchant_dim"))
  .settings(
    idePackagePrefix := Some(s"$packagePrefix.dim"),
    libraryDependencies ++= sharedDependencies
  )
  .dependsOn(common )

lazy val order_item_detail_dwd = (project in file("dwd/order_item_detail_dwd"))
  .settings(
    idePackagePrefix := Some(s"$packagePrefix.dwd"),
    libraryDependencies ++= sharedDependencies
  )
  .dependsOn(common)


lazy val order_merchant_summary_daily_dws = (project in file("dws/order_merchant_summary_daily_dws"))
  .settings(
    idePackagePrefix := Some(s"$packagePrefix.dws"),
    libraryDependencies ++= sharedDependencies
  )
  .dependsOn(common)


lazy val order_sku_sale_daily_dws = (project in file("dws/order_sku_sale_daily_dws"))
  .settings(
    idePackagePrefix := Some(s"$packagePrefix.dws"),
    libraryDependencies ++= sharedDependencies
  )
  .dependsOn(common)

lazy val merchant_spu_topn_daily_ads = (project in file("ads/merchant_spu_topn_daily_ads"))
  .settings(
    idePackagePrefix := Some(s"$packagePrefix.ads"),
    libraryDependencies ++= sharedDependencies
  )
  .dependsOn(common)


lazy val merchant_order_summary_daily_ads = (project in file("ads/merchant_order_summary_daily_ads"))
  .settings(
    idePackagePrefix := Some(s"$packagePrefix.ads"),
    libraryDependencies ++= sharedDependencies
  )
  .dependsOn(common)




